import { InlineKeyboard } from "puregram";

export const updateButton = ({
    command,
    caller = null,
    payload = {},
    text = "🔃Обновить",
}) => {
    const rows = [
        [
            InlineKeyboard.textButton({
                text,
                payload: {
                    command,
                    ...payload,
                },
            }),
        ],
    ];
    if (typeof caller === "string") {
        rows.push([
            InlineKeyboard.urlButton({
                text: "Вызвавший",
                url: caller,
                payload: { command: "_caller" },
            }),
        ]);
    }

    return InlineKeyboard.keyboard(rows);
};
